package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Statemp4;
import com.ruoyi.system.service.IStatemp4Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 静态视频MP4文件Controller
 * 
 * @author ç¹è½æ²
 * @date 2025-05-06
 */
@RestController
@RequestMapping("/system/statemp4")
public class Statemp4Controller extends BaseController
{
    @Autowired
    private IStatemp4Service statemp4Service;

    /**
     * 查询静态视频MP4文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:list')")
    @GetMapping("/list")
    public TableDataInfo list(Statemp4 statemp4)
    {
        startPage();
        List<Statemp4> list = statemp4Service.selectStatemp4List(statemp4);
        return getDataTable(list);
    }

    /**
     * 导出静态视频MP4文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:export')")
    @Log(title = "静态视频MP4文件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Statemp4 statemp4)
    {
        List<Statemp4> list = statemp4Service.selectStatemp4List(statemp4);
        ExcelUtil<Statemp4> util = new ExcelUtil<Statemp4>(Statemp4.class);
        util.exportExcel(response, list, "静态视频MP4文件数据");
    }

    /**
     * 获取静态视频MP4文件详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(statemp4Service.selectStatemp4ById(id));
    }

    /**
     * 新增静态视频MP4文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:add')")
    @Log(title = "静态视频MP4文件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Statemp4 statemp4)
    {
        return toAjax(statemp4Service.insertStatemp4(statemp4));
    }

    /**
     * 修改静态视频MP4文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:edit')")
    @Log(title = "静态视频MP4文件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Statemp4 statemp4)
    {
        return toAjax(statemp4Service.updateStatemp4(statemp4));
    }

    /**
     * 删除静态视频MP4文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp4:remove')")
    @Log(title = "静态视频MP4文件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(statemp4Service.deleteStatemp4ByIds(ids));
    }
}
